package j2024.j202408;

import java.util.Scanner;

public class j0806 {
    public static void main1(String[] args) {
        Scanner in = new Scanner(System.in);
        long a = in.nextLong(),h = in.nextLong(),b = in.nextLong(),k = in.nextLong();
        long count = 0;
        while(true){
            count+=(a+b);
            h-=b;
            k-=a;
            if(h<=0&&k<=0){
                break;
            }else if(h<=0){
                count+=10*b;
                break;
            }else if(k<=0){
                count+=10*a;
                break;
            }
        }
        System.out.println(count);
    }

    public static void main2(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        long[] arr = new long[n];
        for (int i = 0; i < n; i++) {
            arr[i] = in.nextLong();
        }
        long max = Integer.MIN_VALUE;
        long tmp = 0;
        for (int i = 0; i < n; i++) {
            if(tmp<0){
                tmp = arr[i];
            }else {
                tmp+=arr[i];
            }
            max = Math.max(max,tmp);
        }
        System.out.println(max);
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.next();
        char[] ch = s.toCharArray();
        int max = 0;
        for (int i = 0; i < s.length(); i++) {
            int mid = i;
            int ml = i-1,mr = i+1;
            int tmp1 = 1;
            boolean b1 = true;
            while(ml>=0 && mr<s.length()){
                if(ch[ml]!=ch[mr]){
                    tmp1+=2;
                    ml--;
                    mr++;
                }else {
                    b1 = false;
                    break;
                }
            }
            if(b1){
                while(ml>=0){
                    ml--;
                    tmp1++;
                }
                while(mr<s.length()){
                    mr++;
                    tmp1++;
                }
            }
            int tmp2 = 0;
            int l = i,r = i+1;
            boolean b2 = true;
            while(l>=0 && r<s.length()){
                if(ch[l]!=ch[r]){
                    tmp2+=2;
                    l--;
                    r++;
                }else {
                    b2 = false;
                    break;
                }
            }
            if(b2){
                while(l>=0){
                    l--;
                    tmp2++;
                }
                while(r<s.length()){
                    r++;
                    tmp2++;
                }
            }
            int tmp = Math.max(tmp1,tmp2);
            max = Math.max(max,tmp);
        }
        System.out.println(max);
    }
}
class leet86_1{
    public int tribonacci(int n) {
        if(n<=2){
            if(n==0){
                return 0;
            }else {
                return 1;
            }
        }
        int[] dp = new int[n+1];
        dp[0] = 0;dp[1] = 1;dp[2] = 1;
        for (int i = 3; i <= n; i++) {
            dp[i] = dp[i-1]+dp[i-2]+dp[i-3];
        }
        return dp[n];
    }
}
